//accepted 
#include <cstdio>
int n, x, i;
int main(){
	freopen("in.txt","r",stdin);//freopen("out.txt","w",stdout);
	scanf("%d", &n);
	while(n){
		n*=n;
		for(x=0,i=1;i*i<=n;++i){
			x+=i*i;
		}
		printf("%d\n", x);
		
		scanf("%d", &n);
	}
	return 0;
}
